﻿using Pay.Configuration;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Pay.Dapper
{
    /// <summary>
    /// 连接factory
    /// </summary>
    public class ConnectionFactory
    {

        private static readonly string readString = Config.GetValue("database:connection");

        private static readonly string writeString = Config.GetValue("database:connection");

        /// <summary>
        /// 获取读连接对象
        /// </summary>
        /// <returns></returns>
        public static IDbConnection GetReadConnection()
        {
            return new SqlConnection(readString);
        }

        /// <summary>
        /// 获取写连接对象
        /// </summary>
        /// <returns></returns>
        public static IDbConnection GetWriteConnection()
        {
            return new SqlConnection(writeString);
        }

    }
}
